﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="QL_Activities.aspx.cs" Inherits="ChineseSchool.Admin.QL_Activities" ValidateRequest="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>

<%@ Register TagPrefix="FCKeditorV2" Namespace="FredCK.FCKeditorV2" Assembly="FredCK.FCKeditorV2, Version=2.6.3.22451, Culture=neutral, PublicKeyToken=4f86767c9b519a06" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .form-horizontal .control-label
        {
            text-align: left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Top" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Panel ID="panAdd" runat="server" Visible="false">
        <div class="row">
            <div class="col-md-10">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <asp:Label ID="lblTitle" runat="server"></asp:Label>
                    </div>
                    <div class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <asp:Label ID="lblImageUrlUpload" Text="Ảnh đại diện:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:FileUpload ID="fuImageUrl" runat="server" ToolTip="Tải lên ảnh đại diện" />
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblActivitiesDate" runat="server" Text="Ngày:" CssClass="col-sm-2 control-label" />
                                <div class="col-sm-10">
                                    <div class="col-sm-11" style="padding: 0">
                                        <asp:TextBox runat="server" ID="txtActivitiesDate" Text='<%# Bind("ActivitiesDate") %>'
                                            MaxLength="150" CssClass="form-control"></asp:TextBox>
                                    </div>
                                    <div class="col-sm-1">
                                        <asp:ImageButton ID="ibtCal" runat="server" CssClass="form-control" ImageUrl="Images/calendar.png" />
                                        <ajax:CalendarExtender ID="cldDate" Format="dd/MM/yyyy" TargetControlID="txtActivitiesDate"
                                            PopupButtonID="ibtCal" runat="server">
                                        </ajax:CalendarExtender>
                                    </div>

                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblTitleData" Text="Tiêu đề:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtTitle" Text='<%# Bind("ActivitiesTitle") %>' MaxLength="150"
                                        CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblActivitiesContent" Text="Nội dung:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <FCKeditorV2:FCKeditor ID="ckActivitiesContent" runat="server" Height="800px"></FCKeditorV2:FCKeditor>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <asp:Button ID="btnAdd" runat="server" Text="Thêm mới" CssClass="btnSubmit" OnClick="btnAdd_Click" />
                            <asp:Button ID="btnEdit" runat="server" Text="Cập nhật" CssClass="btnSubmit"
                                OnClick="btnEdit_Click" />
                            <asp:Button ID="btnCancel" runat="server" Text="Hủy" OnClick="btnCancel_Click" />
                        </div>
                        <!-- /.box-footer -->
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <div class="row">
        <div class="col-xs-12">
            <asp:Label ID="lblThongbao" runat="server" Text="" CssClass="control-label"></asp:Label>
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">Danh sách tin tức:</h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <asp:GridView ID="grdActivities" runat="server" AutoGenerateColumns="False"
                        AllowPaging="True" EnableModelValidation="True" CssClass="table table-bordered"
                        AllowSorting="True"
                        OnRowCommand="grdActivities_RowCommand" OnRowDeleting="grdActivities_RowDeleting"
                        OnRowEditing="grdActivities_RowEditing" OnPageIndexChanging="grdActivities_PageIndexChanging"
                        PageSize="20">
                        <PagerStyle CssClass="grdPaging" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <Columns>
                            <asp:TemplateField HeaderText="Stt" HeaderStyle-Width="20px">
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ActivitiesID" Visible="false" />
                            <asp:TemplateField ItemStyle-Width="80px" HeaderText="Ảnh đại diện" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <img src='<%# Eval("ImageUrl") %>' width="30px" alt=""></img>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ActivitiesTitle" HtmlEncode="false" HeaderText="Tiêu đề" HeaderStyle-Width="450px" ReadOnly="true" />
                            <asp:BoundField DataField="ActivitiesDate" HeaderText="Ngày đăng" HeaderStyle-Width="150px"
                                DataFormatString="{0:dd/MM/yyyy}" ReadOnly="true" />
                            <asp:TemplateField ItemStyle-Width="20px" HeaderText="Sửa" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgedit" runat="server" ImageUrl="Images/edit.png" ToolTip="Sửa thông tin"
                                        CommandArgument='<%# Eval("ActivitiesID") %>' CommandName="Edit" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ItemStyle-Width="20px" HeaderText="Xóa" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgDel" runat="server" ImageUrl="Images/del.gif" ToolTip="Xóa hoạt động"
                                        CommandArgument='<%# Eval("ActivitiesID") %>' CommandName="Delete" OnClientClick=" return confirm('Bạn có chắc chắn muốn xoá?') " />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div align="left" style="font-weight: bold">
                        <asp:Label ID="lbl_count" runat="server" Visible="false"></asp:Label>
                    </div>
                </div>

                <div class="box-footer clearfix">
                    <div class="col-xs-6 text-left">
                        <i>Bạn đang xem trang
                            <%=grdActivities.PageCount==0 &&  grdActivities.PageIndex == 0 ? 0 : grdActivities.PageIndex+1%>
                            của
                            <%=grdActivities.PageCount%></i>
                    </div>
                    <div class="col-xs-6 text-right">
                        <asp:Button ID="btnNew" runat="server" Text="Thêm mới" OnClick="btnNew_Click" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
